﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using Defarm.Annotations;

namespace Defarm.Model.DB
{
    public class Position : INotifyPropertyChanged
    {
        #region Fields

        private int quantity;

        #endregion

        #region Public properties

        public Guid Id { get; set; }

        public string Name { get; set; }

        public int Quantity
        {
            get
            {
                return quantity;
            }

            set
            {
                this.quantity = value;
                this.OnPropertyChanged("Quantity");
            }
        }

        public virtual ICollection<OrderMap> OrderMaps { get; set; }
 
        public virtual ICollection<OutcomeMap> OutcomeMaps { get; set; }

        public virtual ICollection<SaleMap> SaleMaps { get; set; } 

        #endregion

        #region Events

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Methods

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
